How to Convert an Integer to an Array of Digits in JavaScript